<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:42:"themes/simpleboot3/blog/message/index.html";i:1512651686;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>许个愿吧！</title>
    <!-- head 中 -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.2/style/weui.min.css">
    <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.0/css/jquery-weui.min.css">
    <!--动画-->
    <link rel="stylesheet" href="__TMPL__/public/view/css/animate.css">
    <!-- jQuery -->
    <script src="__TMPL__/public/view/js/jquery.min.js"></script>
    <!--vue-->
    <script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>
<body>
    <div class="adsss" style="margin-bottom: 14em">
        <div class="weui-cells ads"  style="font-size: 12px">

        </div>
    </div>
    <!-- 使用 WeUI -->
    <div class="weui-cells weui-cells_form down">
        <div class="weui-cells__title warning">写下你的愿望吧！</div>
            <div class="weui-cells weui-cells_form">
                <div class="weui-cell">
                    <div class="weui-cell__bd">
                        <textarea class="weui-textarea text1" placeholder="请输入......." rows="3"></textarea>
                        <div class="weui-textarea-counter">
                            <span id="max1">0</span>/240
                        </div>
                    </div>
                </div>
            </div>
        <a href="javascript:;" class="weui-btn weui-btn_primary buoo">发送</a>
    </div>
    <script>
        window.onload = function(){
            $.ajax({
                url:'http://www.luck7.top/blog/message/backmessage',
                type:"post",
                data:{},
                success:function(data){
                    var ress= $.parseJSON(data);
                    $.each(ress, function (n, value) {
                        $('.ads').prepend(
                            "<div class=\"weui-cell animated bounceInLeft\">"+
                            "<div class=\"weui-cell__bd\">"+
                            "<p>第 "+value.id+" 条</p>"+
                            "</div>"+
                            "<div class=\"weui-cell__ft\">"+
                            value.text+"<br>"+value.time+
                            "</div>"+
                            "</div>"
                        );
                        $.toast('加载成功！');
                    });
                },
                error:function(e){
                    $.toast('加载失败！', "cancel");
                }
            });
        };

            $('.text1').bind(' input propertychange ',function(){
                var lenss = $('.text1').val().length;
                $('#max1').text(lenss);
                if(lenss > 240){
                    $('.buoo').hide();
                    $('.warning').css('color','red').text('字数超过限制！');
                }else if(lenss < 240){
                    $('.buoo').show();
                    $('.warning').text('写下你的愿望吧！');
                }
            } );
            $('.buoo').click(function(){
                var text0 = $('.text1').val();
                $('.buoo').text('发送中...');
                $.ajax({
                    url:'http://www.luck7.top/blog/message/acceptmessage',
                    type:"post",
                    data:{
                        text1:text0
                    },
                    success:function(data){
                        $('.buoo').text('发送');
                        $('.text1').val('');
                        $('#max1').text(0);
                        var ress= $.parseJSON(data);
                        if(ress.sta){
                            $('.ads').prepend(
                                "<div class=\"weui-cell animated bounceInLeft\">"+
                                "<div class=\"weui-cell__bd\">"+
                                "<p>第 "+ress.ids+" 条</p>"+
                                "</div>"+
                                "<div class=\"weui-cell__ft\">"+
                                ress.text3+"<br>"+ress.timee+
                                "</div>"+
                                "</div>"
                            );
                        }
                        if(ress.sta==1){
                            $.toast("发送成功！");
                        }else{
                            $.toast(ress,'cancel');
                        }
                    },
                    error:function(e){
                        $('.buoo').text('发送');
                        $.toast('失败啦！！', "cancel");
                    }
                });
            })
    </script>
    <!--style-->
    <style>
        .down{
            padding: .5em .38em;
            width: 96.5%;
            position: fixed;
            bottom: 0;
            z-index: 999;
        }
        .warning{
            color: black;
        }
    </style>
<!-- body 最后 -->
<script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/jquery-weui.min.js"></script>
</body>
</html>